package cn.stronglink.asset.terminal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;

import cn.stronglink.asset.model.RfidState;

public class test10 {

	
	
	public static void main(String[] args) {
		
		List<RfidState> aa = new ArrayList<RfidState>();
		

		RfidState  rf0 = new RfidState();
		rf0.setRfidNo("EA0002DC");
		rf0.setU(24);
		rf0.setRackConverCode("1010F7");
		aa.add(rf0);
		
		
		
		List<RfidState> bb = new ArrayList<RfidState>();
		
		RfidState  rf1 = new RfidState();
		rf1.setRfidNo("EA000261");
		rf1.setU(16);
		rf1.setRackConverCode("1010F7");
		bb.add(rf1);
		
		RfidState  rf2 = new RfidState();
		rf2.setRfidNo("EA0002DC");
		rf2.setU(21);
		rf2.setRackConverCode("1010F7");
		bb.add(rf2);
		
		
		new test10().compareInventorySheet(aa, bb);
		
	}
	
	// aa �̵��豸
	
	// bb ̨���豸
	
	private void compareInventorySheet(List<RfidState> aa, List<RfidState> bb) {
		
		
		Collection yingdata = new HashSet<String>();
		Collection kuidata = new HashSet<String>();
		Collection chayidata = new HashSet<String>();
		
		if(aa.size()>=bb.size()){
			// ��ӯ
			
			for(int i=0;i<aa.size();i++){
				
				RfidState rfobj =aa.get(i);
				boolean cc =false;
				for(int j=0;j<bb.size();j++){
					RfidState rfobj2=bb.get(j);
					
					if(rfobj.getRfidNo().equals(rfobj2.getRfidNo())){
						cc=true;
						if(!rfobj.getU().equals(rfobj2.getU())){
							// �в���
							chayidata.add(rfobj.getRfidNo());
							System.out.println(rfobj.getRfidNo()+"差异");
						}
						break;
					}
				}
				if(!cc){
					// 盘盈
					System.out.println(rfobj.getRfidNo()+"盘盈");
					yingdata.add(rfobj.getRfidNo());
				}
			}
			
			
		}
		
		if(aa.size()<bb.size()){
			// �̿�
			
			for(int i=0;i<bb.size();i++){
				
				RfidState rfobj =bb.get(i);
				boolean cc =false;
				for(int j=0;j<aa.size();j++){
					RfidState rfobj2=aa.get(j);
					
					if(rfobj.getRfidNo().equals(rfobj2.getRfidNo())){
						cc=true;
						if(!rfobj.getU().equals(rfobj2.getU())){
							// �в���
							chayidata.add(rfobj);
							System.out.println(rfobj.getRfidNo()+"差异");
						}
						break;
					}
				}
				if(!cc){
					// 盘亏
					kuidata.add(rfobj);
					System.out.println(rfobj.getRfidNo()+"盘亏");
				}
			}
			
			
		}
		
	}
	
}
